                            <? $frmtime = time(); ?>
                            <div class="main">
                                <h3 class="title"><?=$clabel?> &raquo; <?=$mlabel?></h3>
                                <div class="formdiv">
                                    <form method="POST" id="frmAddVehicleStaff<?=$frmtime?>">
                                        <table>
                                            <? if( isset($errors) ) {
                                               foreach($errors as $error) {
                                               ?>
                                            <tr>
                                                <td class="errormsg" colspan="3">
                                                    <?=$error?>    
                                                </td>
                                            </tr>   
                                               <? 
                                               } 
                                            }  ?>
                                            <? if( isset($successes) ) {
                                               foreach($successes as $success) {
                                               ?>
                                            <tr>
                                                <td class="successmsg" colspan="3">
                                                    <?=$success?>    
                                                </td>
                                            </tr>   
                                               <? 
                                               } 
                                            }  ?>
                                            <tr>
                                                <td><label for="vs_staff_type<?=$frmtime?>">Staff Type*</label></td>
                                                <td>
                                                    <select id="vs_staff_type<?=$frmtime?>" class="text required" name="vs_staff_type">
                                                        <option value="">-- Select --</option>
                                                        <?
                                                            if(isset($vstlist) && is_array($vstlist) && count($vstlist) > 0) {
                            	                               foreach( $vstlist as $stafftype ) {
                            	                                   $sel = '';
                            	                                   if(isset($postdata["vs_staff_type"]) && $stafftype["value"]==$postdata["vs_staff_type"]) { $sel = "selected"; }
                                                        ?>
                                                                <option value="<?=$stafftype["value"]?>" <?=$sel?>><?=$stafftype["label"]?></option>
                                                        <?
                            	                           }
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_name">Name*</label></td>
                                                <td>
                                                    <input type="text" class="text required" maxlength="50" minlength="3"  name="vs_name" value="<?=$postdata['vs_name']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_joining_date<?=$frmtime?>">Joining Date*</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext required {validate:{date:true}}" id="vs_joining_date<?=$frmtime?>" name="vs_joining_date" value="<?=$postdata['vs_joining_date']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_dob<?=$frmtime?>">Date of Birth*</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext required {validate:{date:true}}" id="vs_dob<?=$frmtime?>" name="vs_dob" value="<?=$postdata['vs_dob']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_email<?=$frmtime?>">Email</label></td>
                                                <td>
                                                    <input type="text" class="text email" name="vs_email" value="<?=$postdata['vs_email']?>" id="vs_email<?=$frmtime?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_mobile<?=$frmtime?>">Mobile*</label></td>
                                                <td>
                                                    <input type="text" class="text required digits" name="vs_mobile" value="<?=$postdata['vs_mobile']?>"  id="vs_mobile<?=$frmtime?>"/>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_phone<?=$frmtime?>">Telephone</label></td>
                                                <td>
                                                    <input type="text" class="text digits" name="vs_phone" value="<?=$postdata['vs_phone']?>" id="vs_phone<?=$frmtime?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_address<?=$frmtime?>">Address*</label></td>
                                                <td>
                                                    <textarea rows="3" cols="20" class="text required" maxlength="200" minlength="10" name="vs_address" id="vs_address<?=$frmtime?>"><?=$postdata['vs_address']?></textarea>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_nationality">Nationality*</label></td>
                                                <td>
                                                    <select class="text required chzn-select" name="vs_nationality">
                                                        <option value="">-- Select --</option>
                                                        <?
                                                            if(isset($countrylist) && is_array($countrylist) && count($countrylist) > 0) {
                            	                               foreach( $countrylist as $country ) {
                            	                                   $sel = '';
                            	                                   if(isset($postdata["vs_nationality"]) && $country["id"]==$postdata["vs_nationality"]) { $sel = "selected"; }
                                                        ?>
                                                                <option value="<?=$country["id"]?>" <?=$sel?>><?=$country["name"]?></option>
                                                        <?
                            	                           }
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_rp_no<?=$frmtime?>">RP No.*</label></td>
                                                <td>
                                                    <input type="text" id="vs_rp_no<?=$frmtime?>" class="text required" name="vs_rp_no" value="<?=$postdata['vs_rp_no']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_rp_expiry<?=$frmtime?>">RP Expiry*</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext required {validate:{date:true}}" id="vs_rp_expiry<?=$frmtime?>" name="vs_rp_expiry" value="<?=$postdata['vs_rp_expiry']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_sponsor_name<?=$frmtime?>">Sponsor Name</label></td>
                                                <td>
                                                    <input type="text" id="vs_sponsor_name<?=$frmtime?>" class="text" name="vs_sponsor_name" value="<?=$postdata['vs_sponsor_name']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_license_no<?=$frmtime?>">License No.</label></td>
                                                <td>
                                                    <input type="text" id="vs_license_no<?=$frmtime?>" class="text" name="vs_license_no" value="<?=$postdata['vs_license_no']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="vs_license_expiry<?=$frmtime?>">License Expiry</label></td>
                                                <td>
                                                    <input type="text" readonly="true" class="stext {validate:{date:true}}" id="vs_license_expiry<?=$frmtime?>" name="vs_license_expiry" value="<?=$postdata['vs_license_expiry']?>" />
                                                    <label>YYYY-MM-DD</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                        	<tr>
                                        		<td></td>
                                        		<td colspan="2">
                                                    <input class="button" type="submit" name="btnAddStaff" value="Add" id="btnAddStaff<?=$frmtime?>" />
                                                    <input class="button" type="reset" value="Cancel" id="btnreset<?=$frmtime?>" />
                                                </td>
                                        	</tr>
                                        </table>
                                	</form>
                                    <script language="javascript" type="text/javascript">
                                        if(typeof jQuery == 'undefined') {
                                            alert('Invalid Request');
                                            window.location = "/";
                                        }
                                        $(document).ready( function() {
                                            var frmObj = $("#frmAddVehicleStaff<?=$frmtime?>");
                                            $("#frmAddVehicleStaff<?=$frmtime?>").validate({
                                                errorPlacement: function(error, element) {
                                                    placeError(error, element);
                                                },
                                                submitHandler: function(form) {
                                                    var cui = $('#contenttabs .ui-tabs-panel:visible');                                                                                                        
                                               	    var jqxhr = $.post(
                                                        "/transport/addvehiclestaff", 
                                                        $("#frmAddVehicleStaff<?=$frmtime?>").serialize(), 
                                                        function (data) {
                                                            $(cui).html(data);
                                                        }
                                                    );
                                                    $(cui).html('<div id="loadingdiv"><div class="centerdiv"><strong>Processing</strong><br/><img src="/images/ajaxloader.gif" /></div></div>');
                                                }
                                            });
                                            $(".chzn-select",frmObj).chosen({no_results_text: "No results matched"});
                                            $("input[name='vs_dob']",frmObj).datepicker({ 
                                                yearRange: '-60:-16',
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true,
                                                maxDate: '+16y' 
                                            });
                                            $("input[name='vs_joining_date']",frmObj).datepicker({ 
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true,
                                                maxDate: new Date() 
                                            });
                                            $("input[name='vs_rp_expiry']",frmObj).datepicker({ 
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true
                                            });
                                            $("input[name='vs_license_expiry']",frmObj).datepicker({ 
                                                dateFormat: 'yy-mm-dd',
                                                changeMonth: true,
                                                changeYear: true
                                            });
                                            $("input[type='reset']",frmObj).click( function() {
                                                $('label.error',frmObj).remove();
                                            });
                                            
                                            
                                        });
                                    </script>
                                 </div>
                            </div>